package cate.common.table.item.spice.sheet;

import cate.common.table.ESheet;
import cate.common.table.item.spice.row.SpiceCallBaseRow;
import easy.java.dev.note.NoteClass;

@NoteClass(value = "占星类型")
public class SpiceCallBaseSheet extends ESheet<SpiceCallBaseRow> {
    @Override
    public String getSheetName() {
        return "占星类型";
    }

    public int randomPos(int pos) {
        SpiceCallBaseRow row = getList().stream().filter(e -> e.id == pos).findAny().orElse(null);
        if (row != null && row.successPercent > 0 && Math.random() < row.successPercent) {
            return pos + 1;
        }
        return 1;
    }
}
